<?php
import( 'de.ceus-media.framework.krypton.core.DefinitionView' );
/**
 *	Log in View.
 *	@package		mv2.view.authentication
 *	@extends		CMF_Krypton_Core_DefinitionView
 *	@author			Christian W�rker <Christian.Wuerker@CeuS-Media.de>
 *	@since			23.04.2007
 *	@version		0.1
 */
/**
 *	Log in View.
 *	@package		mv2.view.authentication
 *	@extends		CMF_Krypton_Core_DefinitionView
 *	@author			Christian W�rker <Christian.Wuerker@CeuS-Media.de>
 *	@since			23.04.2007
 *	@version		0.1
 */
class View_Authentication_Login extends CMF_Krypton_Core_DefinitionView
{
	/**
	 *	Builds Views.
	 *	@access		public
	 *	@return		string
	 */
	public function buildContent()
	{
		$request	= $this->registry->get( 'request' );
		$auth		= $this->registry->get( 'auth' );
		
		$content	= "";
		if( !$auth->isAuthenticated() )
		{
			$content	.= $this->buildContentLogin();
		}
		return $content;
	}

	/**
	 *	Builds Log in View.
	 *	@access		protected
	 *	@return		string
	 */
	protected function buildContentLogin()
	{
		$request	= $this->registry->get( 'request' );
		$words		= $this->words['auth']['loginUser'];

		$ui				= $this->buildForm( 'auth', 'loginUser', 'auth', 'loginUser' );
		$button_login	= UI_HTML_Elements::Button( 'loginUser', $words['button_login'], 'but edit' );
		if( $request->get( 'sale_id') )
		{
			$ui['text_top']	= $this->loadContent( 'authentication.login_sale.html' );
		}
		else
		{
			$ui['text_top']	= $this->loadContent( 'authentication.login_top.html' );
		}
		$ui['text_bottom']	= $this->loadContent( 'authentication.login_bottom.html' );
		$ui['link_password']	= UI_HTML_Elements::Link( "?link=password", $words['link_password'] );
		$ui['link_register']	= UI_HTML_Elements::Link( "?link=register", $words['link_register'] );
		$ui['field_button']		= UI_HTML_Elements::Field( '', $button_login );
		$ui['form']		= UI_HTML_Elements::Form( 'login', "?link=".$request->get( 'link' )."&sale_id=".$request->get( 'sale_id') );
		$ui['caption']	= UI_HTML_Elements::TableCaption( $words['caption'] );
		$ui['colgroup']	= UI_HTML_Elements::ColumnGroup( $words['colgroup'] );
		$ui['heading']	= $words['heading'];

		return $this->loadTemplate( 'authentication.login', $ui );
	}	
	
	/**
	 *	Builds Extra Panel.
	 *	@access		public
	 *	@return		string
	 */
	public function buildExtra()
	{
//		return $this->loadContent( 'purchase.market.car.extra.html' );
	}
}
?>
